#include "core/main.h"

void Frame::Render(Bitmap &target, const SpriteCollection &collection) const
{
    //target.Clear(RGBColor::Cyan);
    target.Clear();

    vector<SpriteLocation> sortedSprites = sprites;
    sort(sortedSprites.begin(), sortedSprites.end());

    for(auto it = sortedSprites.begin(); it != sortedSprites.end(); it++)
    {
        auto &curSprite = collection.GetSprite(it->spriteID);
        if(curSprite.transparent)
        {
            curSprite.bmp.TransparentBltTo(target, it->coord.x, it->coord.y);
        }
        else
        {
            curSprite.bmp.BltTo(target, it->coord.x, it->coord.y);
        }
    }
}
